package mx.vlabs.soapdroid.wsdl2java.ui;

import javax.swing.JWindow;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import javax.swing.SwingConstants;
import java.awt.Font;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;
import java.awt.Color;
import javax.swing.ImageIcon;
import javax.swing.border.EmptyBorder;

public class LoaderWindow extends JWindow {

	/**
	 * Create the panel.
	 */
	private JLabel lblLoading;
	
	public LoaderWindow() {
		BorderLayout borderLayout = (BorderLayout) getContentPane().getLayout();
		
		JPanel pnlMain = new JPanel();
		pnlMain.setBackground(Color.WHITE);
		pnlMain.setBorder(new LineBorder(Color.GRAY));
		pnlMain.setLayout(new BorderLayout(0, 0));
		
		
		JPanel pnlSub = new JPanel();
		pnlSub.setBackground(Color.WHITE);
		pnlSub.setBorder(new EmptyBorder(10, 10, 10, 10));
		pnlSub.setLayout(new BorderLayout(0, 0));
		
		lblLoading = new JLabel("Loading...");
		pnlSub.add(lblLoading,BorderLayout.SOUTH);
		lblLoading.setFont(new Font("Tahoma", Font.BOLD, 11));
		lblLoading.setHorizontalAlignment(SwingConstants.CENTER);
		
		JLabel lblImage = new JLabel("");
		lblImage.setIcon(new ImageIcon(LoaderWindow.class.getClassLoader().getResource("mx/vlabs/soapdroid/wsdl2java/images/143.gif")));
		lblImage.setHorizontalAlignment(SwingConstants.CENTER);
		pnlSub.add(lblImage, BorderLayout.CENTER);
		
		pnlMain.add(pnlSub);
		
		getContentPane().add(pnlMain, BorderLayout.CENTER);
		
		setSize(100, 100);
		
	}
	
	public void setLoadingMessage(String message){
		lblLoading.setText(message);
	}

}
